package cn.edu.nju.ws.sview.reasoning.reasoner;

import java.util.HashSet;

import cn.edu.nju.ws.sview.rdf.URIResource;

/**
 * deal with the following task in one entity or collection browsing:
 * 		1) Check whether to dereference a given uri to get its rdf document
 * 	
 * @author ssgong
 *
 */
public class ViewReasoner{
	/*store relevant origin uris of an entity or collection*/
	private HashSet<URIResource> entities = null;
	
	/*store one-step neighbors which do not include entities*/
	private HashSet<URIResource> neighbors =null;
	
	public  ViewReasoner( HashSet<URIResource> entities){ 
		this.entities = new HashSet<URIResource>();
		this.entities.addAll(entities) ;
		this.neighbors = new HashSet<URIResource>();
    }
	
	/**
	 * One constant in the arugments of facts must be in entities
	 * @param facts
	 * @param inverse
	 */
	public void storeNeighbors(URIResource uriResource){
		if(!this.entities.contains(uriResource))
			this.neighbors.add(uriResource) ;
	}
	
	/**
	 * check where the uri need to dereference
	 * @param uriResource
	 * @return
	 */
	public boolean isValid(URIResource uriResource){
		if(this.entities.contains(uriResource)||this.neighbors.contains(uriResource))
			return true;
		else 
			return false;
	}
	
	public HashSet<URIResource> getEntities(){
		return this.entities;
	}
	
}
